<?php
class Images extends Basecontroll{
    
     public function __construct() {
         parent::__construct();
     }

     public function index(){
         $pic      = isset($_REQUEST["pic"])? $_REQUEST['pic'] : '';
         $style    = isset($_REQUEST["style"]) ? $_REQUEST['style'] : '';
         $file_info=$this->upload->getImage($pic,$style);
            ob_end_clean();
            if(strpos(strtolower($pic),".jpg")!==false)
            {
              header("Content-type: image/jpg");
            }	
            else if(strpos(strtolower($pic),".png")!==false)
            {
                    header("Content-type: image/png");
            }
            else if(strpos(strtolower($pic),".gif")!==false)
            {
                    header("Content-type: image/gif");
            }
            else if(strpos(strtolower($pic),".jpeg")!==false)
            {
                    header("Content-type: image/jpeg");
            }
            else
            {
                    
                    die();
            }
            $path_parts = pathinfo($pic);
            header("Content-Disposition: inline; filename=".$path_parts["basename"]);
            readfile($file_info["target"]); 
            exit;
     }
}